Skip to content

[jdbc] Incorrect DateTime results when writing numeric data with use_time_zone property#2066

Closed
haishui126 wants to merge 1 commit intoClickHouse:mainfrom
haishui126:fix-2065
Closed

[jdbc] Incorrect DateTime results when writing numeric data with use_time_zone property#2066
haishui126 wants to merge 1 commit intoClickHouse:mainfrom
haishui126:fix-2065

Conversation

@haishui126
Copy link
Contributor

@haishui126 haishui126 commented Jan 3, 2025

Summary

Refer to #2065.
When I use ClickHouse JDBC to insert data, the server's time zone is UTC, while my client's time zone is UTC+8. The JDBC first converts my numeric data to a LocalDateTime in the UTC time zone. This time object is then treated as a LocalDateTime in the UTC+8 time zone when written into ClickHouse, resulting in the written result being 8 hours behind.

Checklist

Delete items not relevant to your PR:

@mshustov mshustov requested a review from Paultagoras January 16, 2025 07:36
@chernser
Copy link
Contributor

This PR need to be ported/verified with jdbc-v2

@haishui126
Copy link
Contributor Author

@chernser This PR addresses the time zone issue when converting Long type to LocalDateTime type in the clickhouse-data module. The jdbc-v2 does not use the clickhouse-data module, so this change will not affect v2. However, I tested v2 in 0.8.0, and found that writing Long type to DateTime64 is fine, but when writing LocalDateTime type to DateTime64, it seems that the use_time_zone setting does not take effect.

@chernser
Copy link
Contributor

chernser commented Feb 8, 2025

@haishui126 thank you for the info!
I've created the issue #2134

@github-actions
Copy link

This pull request has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in 2 weeks if no further activity occurs. Please feel free to give a status update or ping for review. Thank you for your contributions!

@github-actions github-actions bot added the stale label Mar 11, 2025
@github-actions
Copy link

This pull request has been automatically closed because it has not had any further activity in the last 2 weeks. Thank you for your contributions!

@github-actions github-actions bot closed this Mar 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants